const db = {
  get(key) {
    const value = localStorage.getItem(key);
    try {
      return JSON.parse(localStorage.getItem(key)) || "";
    } catch (error) {
      return value;
    }
  },

  set(key, value) {
    localStorage.setItem(key, JSON.stringify(value));
  },

  del(key) {
    localStorage.removeItem(key);
  },

  clear() {
    localStorage.clear();
  },
};

export default db;
